<template>
	<view class="page">
		<view class="logo">
			<img-cache :src="confData.weblogo" mode="aspectFill"></img-cache>
		</view>
		<view class="versions">
			<text>{{confData.website+' '}}</text><text>{{'_'+versionName}}</text><text>{{'_'+versionCode}}</text>
		</view>
		<view class="about-list">
			<view class="list" @click="onSkip('help')">
				<view class="title">
					<text>使用帮助</text>
				</view>
				<view class="more">
					<text class="iconfont icon-more"></text>
				</view>
			</view>
			<view class="list" @click="onSkip('aboutus')">
				<view class="title">
					<text>隐私政策</text>
				</view>
				<view class="more">
					<text class="iconfont icon-more"></text>
				</view>
			</view>
		</view>
		
		<view class="copyright">
			<text>{{confData.copyright}}</text>
			<text>{{confData.web_site_icp}}</text>
		</view>
	</view>
</template>

<script>
	var _self,loginRes;
	// #ifdef APP-PLUS
	import APPUpdate, { getCurrentNo } from '@/js_sdk/APPUpdate/APPUpdate/index.js';
	// #endif
	export default {
		data() {
			return {
				confData : uni.getStorageSync('confData'),
				versionCode : '',
				versionName : '',
			};
		},
		onLoad(params){
			//_self = this;
			loginRes = this.checkLogin();
			if(!loginRes){return;}
			this.token = loginRes[2];
		},
		onReady(){
			// #ifdef APP-PLUS
			getCurrentNo(res => {
				console.log(res);
				this.versionCode = res.versionCode;
				this.versionName = res.versionName;
			});
			// #endif
		},
		methods:{
			async getconf(){
				uni.request({
					url: this.apiServer+'/apicom/index/getconf',
					header: {'content-type' : "application/x-www-form-urlencoded"},
					method: 'GET',
					timeout: 5000,
					success: res => {
						if(res.data.status == 1){
							this.confData = res.data.data; 
							this.isLoginCode = this.confData.web_reg_code;
							this.isReg = this.confData.is_reg;
							//uni.setStorageSync('confData' , res.data.data);
							//console.log(this.confData);
						}
					}
				});
			},
			/*点击合同协议*/
			async getAgreement(id,token){
				uni.request({
					url: this.apiServer+'/apicom/financing/contract',
					header: {'content-type' : "application/x-www-form-urlencoded"},
					method: 'POST',
					timeout: 5000,
					data:{
						id   : id,
						token: this.token
					},
					success: res => {
						if(res.data.status == 1){
							var title   = res.data.message;
							var content = res.data.data;
							//console.log(content)
						}
					},
					fail:function(e){
						uni.showToast({title:"加载失败!",icon:"none"});
					}
				});
			},
			onSkip(type,url){
				switch (type){
					case 'updata':
						uni.navigateTo({
							url: '/pages/WebOnline/WebOnline?url='+url
						})
						break;
					case 'help':
						uni.navigateTo({
							url: '/pages/Help/Help?id=9&page=1'
						})
						break;
					case 'aboutus':
						uni.navigateTo({
							url: '/pages/Help/Help?id=8&page=1'
						})
						break;
				}
			},
		}
	}
</script>

<style scoped lang="scss">
	@import 'AboutUs.scss';
</style>
